package com.lagou.homework.stage01.module3;

public class Task1 {
    public static void main(String[] args) {
        String str = "ABCD123!@#$%ab";
        int upCase = 0;
        int lowCase = 0;
        int num = 0;
        int other = 0;

        for (int i =0;i<str.length();i++){
            if(str.substring(i,i+1).matches("[A-Z]")) {
                upCase++;
            }else if(str.substring(i,i+1).matches("[a-z]")){
                lowCase++;
            }else if(str.substring(i,i+1).matches("[0-9]")){
                num++;
            }else{
                other++;
            }
        }

        System.out.println("Capital letter :"+upCase);
        System.out.println("Lowercase letter :"+lowCase);
        System.out.println("Digital :"+num);
        System.out.println("Other :"+other);
    }
}
